package com.hyacinth.lotterysystem.common.exception;

import com.hyacinth.lotterysystem.common.errocde.ErrorCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @Author: Yun
 * @Date: 2025/6/10
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class ControllerException extends RuntimeException {
    /**
     * @see com.hyacinth.lotterysystem.common.errocde.ControllerErrorCodeConstants
     */
    private Integer code;
    private String msg;

    // 为了序列化
    public ControllerException() {
    }

    public ControllerException(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }


    public ControllerException(ErrorCode errorCode) {
        this.code = errorCode.getCode();
        this.msg = errorCode.getMsg();
    }
}
